<?php

namespace App\Services\WanSdk;

use App\Services\ChannelService;
use App\Services\ServiceBase;

class ToApkService extends ServiceBase
{
    public function loadSDK($game_channel)
    {
        $channel_info = ChannelService::getInstance()->one($game_channel['channel']);
        if (empty($channel_info)) {
            return false;
        }

        //首字母大写
        $flag           = ucfirst($channel_info['channel_flag']);
        $sdk_class      = "{$flag}Sdk";
        $sdk_class_path = app_path("Services/WanSdk/ToApk/{$sdk_class}.php");
        if (!file_exists($sdk_class_path)) {
            return false;
        }

        $class = "App\\Services\\WanSdk\\ToApk\\{$sdk_class}";
        return new $class($game_channel);
    }
}
